﻿using System; 
using System.Windows.Forms;
using System.Globalization;
using NTTDATA.BEENChina.ResultCertification.Main.ServiceResultCertification;
using NTTDATA.BEENChina.ResultCertification.Main.UI;

namespace NTTDATA.BEENChina.ResultCertification.UI
{
    public partial class FormMain : Form
    {
        public FormMain()
        {
            InitializeComponent();
        }

        private void verfitySettingToolStripMenuItem_Click(object sender, EventArgs e)
        {
             FormVerfityList formVerfityList = new FormVerfityList();
            formVerfityList.MdiParent = this;
            formVerfityList.Show(); 

           
        }

        private void categoryVerfityToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormCategoryModify formCategoryModify = new FormCategoryModify();
            formCategoryModify.MdiParent = this;
            formCategoryModify.Show();
        }

        private void runningSettingToolStripMenuItem_Click(object sender, EventArgs e)
        {
           /* FormCheckCondition formCheckCondition = new FormCheckCondition();
            formCheckCondition.MdiParent = this;
            formCheckCondition.Show();*/

             FormCheckConditionB formCheckCondition = new FormCheckConditionB();
            formCheckCondition.MdiParent = this;
            formCheckCondition.Show();
        }


        private void runToolStripMenuItem_Click(object sender, EventArgs e)
        {
          

            using (ServiceResultCertificationClient client = new ServiceResultCertificationClient())
            {
                client.Start(); 
                 
            }
        }

        private void stopToolStripMenuItem_Click(object sender, EventArgs e)
        {
           

            using (ServiceResultCertificationClient client = new ServiceResultCertificationClient())
            {
                client.Stop();
            }
        }

        private void runningStateToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormMonitor formMonitor = new FormMonitor();
            formMonitor.MdiParent = this;
            formMonitor.Show();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            CultureInfo ci = new CultureInfo("ja-JP");
            Calendar cal = new JapaneseCalendar();
            ci.DateTimeFormat.Calendar = cal;
            DateTime dt = DateTime.Parse("2013/01/01");

            string strWareki = ci.DateTimeFormat.GetAbbreviatedEraName(cal.GetEra(dt)) + dt.ToString("yy", ci);
            Console.WriteLine(strWareki); // output: 平18/09/26 
        }

        private void makeJobToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormMakeJob form = new FormMakeJob();
            form.MdiParent = this;            
            form.Show();
        }

        private void completeOPIDToolStripMenuItem_Click(object sender, EventArgs e)
        {
            using (ServiceResultCertificationClient client = new ServiceResultCertificationClient())
            {
                client.CompleteOpIdAndImage();
            }
        }

       

        private void testToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormImportTestData frm = new FormImportTestData();
            frm.MdiParent = this;
            frm.Show();
        }

        private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FormAboutBox aboutBox = new FormAboutBox();
            aboutBox.MdiParent = this;
            aboutBox.Show();
        }

        private void runnTimeToolStripMenuItem_Click(object sender, EventArgs e)
        {
              var child = new FormCheckRunning();
              child.MdiParent = this;
              child.Show();
        }
    }
}